//
//  PCDApiSetClipboardData.m
//  PCDMPaasBank
//
//  Created by DK on 2021/3/9.
//  Copyright © 2021 Alibaba. All rights reserved.
//

#import "PCDApiSetClipboardData.h"

@implementation PCDApiSetClipboardData

- (void)handler:(id)data andContext:(PCDContext *)context ResponseCallback:(WVJBResponseCallback )responseCallback
{
      
    NSString *callBack = [data objectForKey:@"success"];
    
    NSString *clipboardData = [data objectForKey:@"data"];
    if (![PCDUtil nilOrEmptyString:clipboardData]) {
        UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
        pasteboard.string = clipboardData;
        
        NSDictionary *callBackDict = @{@"_callbackName":@"success"};
        
        if (![PCDUtil nilOrEmptyString:callBack]) {
            //
            evaluateJavaScriptOnMainThread(self,callBack,[callBackDict JSONRepresentation]);
        }
    }
    
}

@end
